package com.app.controller;


import com.app.common.Result;
import com.app.model.Article;
import com.app.service.IArticleService;
import com.app.vo.AdminRoleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author yoominic
 * @since 2024-06-20
 */
@RestController
@RequestMapping("/article")
public class ArticleController {
    @Autowired
    private IArticleService articleService;

    @GetMapping("/miniList")
    public Result<List<Article>> getMiniArticles(String code) {
        return articleService.getMiniArticles(code);
    }

    @GetMapping("/adminList")
    public Result<Object> getAdminArticles(Integer page, Integer limit) {
        return articleService.getAdminArticles(page, limit);
    }
    @GetMapping("/adminById")
    public Result<Object> adminById(Integer id) {
        return Result.success(articleService.getById(id));
    }
    @PostMapping("/update")
    public Result<Object> updateArticle(@RequestBody Article article) {
        return articleService.updateArticle(article);
    }

}

